package com.epfresh.bean;

import java.io.Serializable;
import java.util.UUID;

public class Images implements Serializable {

    private int position;
    private int fatherPosition;

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public int getFatherPosition() {
        return fatherPosition;
    }

    public void setFatherPosition(int fatherPosition) {
        this.fatherPosition = fatherPosition;
    }

    private String imageId;
    private String imgUrl;
    private String url;
    private String imageUrl;
    private String sort;

    private String id;
    private String filePath;
    private String attachmentId;
    private boolean isCover;
    private boolean isBanner;
    //用于标示是否是添加图片
    private transient boolean isAdd = true;
    //用于记录model的唯一性
    private transient String uuid = UUID.randomUUID().toString();
    //用于记录图片状态,0,没有图片,1,上传中,2,上传失败,3,上传成功
    private int type;

    public static int DEFAULT = 0;
    public static int LOADING = 1;
    public static int LOAD_FAIL = 2;
    public static int SUCCESS = 3;


    public boolean isUploadFail(){
        return type == LOAD_FAIL;
    }
    public boolean isUploadSuccess(){
        return type != LOAD_FAIL && type != LOADING;
    }
    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public boolean isAdd() {
        return isAdd;
    }

    public void setAdd(boolean add) {
        isAdd = add;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getImageId() {
        return this.imageId;
    }

    public void setImageId(String imageId) {
        this.imageId = imageId;
    }

    public String getImageUrl() {

        if (this.imgUrl==null){
            if (imageUrl == null){
                return url;
            }
            return imageUrl;
        }
        return imgUrl;
    }

    public void setImageUrl(String imageUrl) {

        this.imageUrl = imageUrl;
        this.imgUrl = imageUrl;
        this.url = imageUrl;
    }

    public String getSort() {
        return this.sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public String getAttachmentId() {
        return attachmentId;
    }

    public void setAttachmentId(String attachmentId) {
        this.attachmentId = attachmentId;
    }

    public boolean isCover() {
        return isCover;
    }

    public void setCover(boolean cover) {
        isCover = cover;
    }

    public boolean isBanner() {
        return isBanner;
    }

    public void setBanner(boolean banner) {
        isBanner = banner;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    @Override
    public String toString() {
        return "Images{" +
                "imageId='" + imageId + '\'' +
                ", imgUrl='" + imgUrl + '\'' +
                ", imageUrl='" + imageUrl + '\'' +
                ", sort='" + sort + '\'' +
                ", id='" + id + '\'' +
                ", filePath='" + filePath + '\'' +
                ", attachmentId='" + attachmentId + '\'' +
                ", isCover=" + isCover +
                ", isBanner=" + isBanner +
                ", isAdd=" + isAdd +
                ", uuid='" + uuid + '\'' +
                ", listType=" + type +
                '}';
    }
}
